#include "platinum.h"
#include "room.h"
#include "player.h"

Room::Room(Dungeon* parent) : CurrentDungeon(parent){}

void Room::SendChat()
{
   mutex.Lock();
   std::vector<Player* >::iterator it;

   while(!ChatQ.empty())
   {
	   for(unsigned int it = 0; it < PlayerList.size(); it++)
	   {
		   PlayerList.at(it)->AddToChatQ(ChatQ.front());
	   }
	   ChatQ.pop();
   }
}

/**
*    ProcessTick() for the Room will call ProcessTick() on all objects contained within it
*    This includes players, aiplayer, items, etc
*/

void Room::ProcessTick()
{    
   for(unsigned int i = 0; i < PlayerList.size();i++)
        PlayerList.at(i)->ProcessTick();

   Platinum::Thread::Yield();
}

void Room::AddChat(std::string msg)
{
	ChatQ.push(msg);
}

std::string Room::getName()
{
	return(Name);
}
Dungeon* Room::MyDungeon()
{
	return CurrentDungeon;
}